import 'package:gameplay_flutter/generated/json/base/json_convert_content.dart';
import 'package:gameplay_flutter/lib_basemodel/discover/gift_record_dto_entity.dart';

GiftRecordDtoEntity $GiftRecordDtoEntityFromJson(Map<String, dynamic> json) {
  final GiftRecordDtoEntity giftRecordDtoEntity = GiftRecordDtoEntity();
  final int? pageNum = jsonConvert.convert<int>(json['pageNum']);
  if (pageNum != null) {
    giftRecordDtoEntity.pageNum = pageNum;
  }
  final int? pageSize = jsonConvert.convert<int>(json['pageSize']);
  if (pageSize != null) {
    giftRecordDtoEntity.pageSize = pageSize;
  }
  final int? size = jsonConvert.convert<int>(json['size']);
  if (size != null) {
    giftRecordDtoEntity.size = size;
  }
  final dynamic orderBy = json['orderBy'];
  if (orderBy != null) {
    giftRecordDtoEntity.orderBy = orderBy;
  }
  final int? startRow = jsonConvert.convert<int>(json['startRow']);
  if (startRow != null) {
    giftRecordDtoEntity.startRow = startRow;
  }
  final int? endRow = jsonConvert.convert<int>(json['endRow']);
  if (endRow != null) {
    giftRecordDtoEntity.endRow = endRow;
  }
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    giftRecordDtoEntity.total = total;
  }
  final int? pages = jsonConvert.convert<int>(json['pages']);
  if (pages != null) {
    giftRecordDtoEntity.pages = pages;
  }
  final List<GiftRecordDtoList>? list = (json['list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<GiftRecordDtoList>(e) as GiftRecordDtoList).toList();
  if (list != null) {
    giftRecordDtoEntity.list = list;
  }
  final int? firstPage = jsonConvert.convert<int>(json['firstPage']);
  if (firstPage != null) {
    giftRecordDtoEntity.firstPage = firstPage;
  }
  final int? prePage = jsonConvert.convert<int>(json['prePage']);
  if (prePage != null) {
    giftRecordDtoEntity.prePage = prePage;
  }
  final int? nextPage = jsonConvert.convert<int>(json['nextPage']);
  if (nextPage != null) {
    giftRecordDtoEntity.nextPage = nextPage;
  }
  final int? lastPage = jsonConvert.convert<int>(json['lastPage']);
  if (lastPage != null) {
    giftRecordDtoEntity.lastPage = lastPage;
  }
  final bool? isFirstPage = jsonConvert.convert<bool>(json['isFirstPage']);
  if (isFirstPage != null) {
    giftRecordDtoEntity.isFirstPage = isFirstPage;
  }
  final bool? isLastPage = jsonConvert.convert<bool>(json['isLastPage']);
  if (isLastPage != null) {
    giftRecordDtoEntity.isLastPage = isLastPage;
  }
  final bool? hasPreviousPage = jsonConvert.convert<bool>(json['hasPreviousPage']);
  if (hasPreviousPage != null) {
    giftRecordDtoEntity.hasPreviousPage = hasPreviousPage;
  }
  final bool? hasNextPage = jsonConvert.convert<bool>(json['hasNextPage']);
  if (hasNextPage != null) {
    giftRecordDtoEntity.hasNextPage = hasNextPage;
  }
  final int? navigatePages = jsonConvert.convert<int>(json['navigatePages']);
  if (navigatePages != null) {
    giftRecordDtoEntity.navigatePages = navigatePages;
  }
  final List<int>? navigatepageNums = (json['navigatepageNums'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<int>(e) as int).toList();
  if (navigatepageNums != null) {
    giftRecordDtoEntity.navigatepageNums = navigatepageNums;
  }
  return giftRecordDtoEntity;
}

Map<String, dynamic> $GiftRecordDtoEntityToJson(GiftRecordDtoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['pageNum'] = entity.pageNum;
  data['pageSize'] = entity.pageSize;
  data['size'] = entity.size;
  data['orderBy'] = entity.orderBy;
  data['startRow'] = entity.startRow;
  data['endRow'] = entity.endRow;
  data['total'] = entity.total;
  data['pages'] = entity.pages;
  data['list'] = entity.list.map((v) => v.toJson()).toList();
  data['firstPage'] = entity.firstPage;
  data['prePage'] = entity.prePage;
  data['nextPage'] = entity.nextPage;
  data['lastPage'] = entity.lastPage;
  data['isFirstPage'] = entity.isFirstPage;
  data['isLastPage'] = entity.isLastPage;
  data['hasPreviousPage'] = entity.hasPreviousPage;
  data['hasNextPage'] = entity.hasNextPage;
  data['navigatePages'] = entity.navigatePages;
  data['navigatepageNums'] = entity.navigatepageNums;
  return data;
}

extension GiftRecordDtoEntityExtension on GiftRecordDtoEntity {
  GiftRecordDtoEntity copyWith({
    int? pageNum,
    int? pageSize,
    int? size,
    dynamic orderBy,
    int? startRow,
    int? endRow,
    int? total,
    int? pages,
    List<GiftRecordDtoList>? list,
    int? firstPage,
    int? prePage,
    int? nextPage,
    int? lastPage,
    bool? isFirstPage,
    bool? isLastPage,
    bool? hasPreviousPage,
    bool? hasNextPage,
    int? navigatePages,
    List<int>? navigatepageNums,
  }) {
    return GiftRecordDtoEntity()
      ..pageNum = pageNum ?? this.pageNum
      ..pageSize = pageSize ?? this.pageSize
      ..size = size ?? this.size
      ..orderBy = orderBy ?? this.orderBy
      ..startRow = startRow ?? this.startRow
      ..endRow = endRow ?? this.endRow
      ..total = total ?? this.total
      ..pages = pages ?? this.pages
      ..list = list ?? this.list
      ..firstPage = firstPage ?? this.firstPage
      ..prePage = prePage ?? this.prePage
      ..nextPage = nextPage ?? this.nextPage
      ..lastPage = lastPage ?? this.lastPage
      ..isFirstPage = isFirstPage ?? this.isFirstPage
      ..isLastPage = isLastPage ?? this.isLastPage
      ..hasPreviousPage = hasPreviousPage ?? this.hasPreviousPage
      ..hasNextPage = hasNextPage ?? this.hasNextPage
      ..navigatePages = navigatePages ?? this.navigatePages
      ..navigatepageNums = navigatepageNums ?? this.navigatepageNums;
  }
}

GiftRecordDtoList $GiftRecordDtoListFromJson(Map<String, dynamic> json) {
  final GiftRecordDtoList giftRecordDtoList = GiftRecordDtoList();
  final int? fromUserId = jsonConvert.convert<int>(json['fromUserId']);
  if (fromUserId != null) {
    giftRecordDtoList.fromUserId = fromUserId;
  }
  final String? fromUserName = jsonConvert.convert<String>(json['fromUserName']);
  if (fromUserName != null) {
    giftRecordDtoList.fromUserName = fromUserName;
  }
  final String? fromUserHeadUrl = jsonConvert.convert<String>(json['fromUserHeadUrl']);
  if (fromUserHeadUrl != null) {
    giftRecordDtoList.fromUserHeadUrl = fromUserHeadUrl;
  }
  final int? targetUserId = jsonConvert.convert<int>(json['targetUserId']);
  if (targetUserId != null) {
    giftRecordDtoList.targetUserId = targetUserId;
  }
  final String? targetUserName = jsonConvert.convert<String>(json['targetUserName']);
  if (targetUserName != null) {
    giftRecordDtoList.targetUserName = targetUserName;
  }
  final String? giftName = jsonConvert.convert<String>(json['giftName']);
  if (giftName != null) {
    giftRecordDtoList.giftName = giftName;
  }
  final int? price = jsonConvert.convert<int>(json['price']);
  if (price != null) {
    giftRecordDtoList.price = price;
  }
  final int? charmValue = jsonConvert.convert<int>(json['charmValue']);
  if (charmValue != null) {
    giftRecordDtoList.charmValue = charmValue;
  }
  final int? amount = jsonConvert.convert<int>(json['amount']);
  if (amount != null) {
    giftRecordDtoList.amount = amount;
  }
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    giftRecordDtoList.createTime = createTime;
  }
  final int? group = jsonConvert.convert<int>(json['group']);
  if (group != null) {
    giftRecordDtoList.group = group;
  }
  final String? objectUrl = jsonConvert.convert<String>(json['objectUrl']);
  if (objectUrl != null) {
    giftRecordDtoList.objectUrl = objectUrl;
  }
  final int? giftType = jsonConvert.convert<int>(json['giftType']);
  if (giftType != null) {
    giftRecordDtoList.giftType = giftType;
  }
  final int? giftSonType = jsonConvert.convert<int>(json['giftSonType']);
  if (giftSonType != null) {
    giftRecordDtoList.giftSonType = giftSonType;
  }
  final int? hotValue = jsonConvert.convert<int>(json['hotValue']);
  if (hotValue != null) {
    giftRecordDtoList.hotValue = hotValue;
  }
  return giftRecordDtoList;
}

Map<String, dynamic> $GiftRecordDtoListToJson(GiftRecordDtoList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['fromUserId'] = entity.fromUserId;
  data['fromUserName'] = entity.fromUserName;
  data['fromUserHeadUrl'] = entity.fromUserHeadUrl;
  data['targetUserId'] = entity.targetUserId;
  data['targetUserName'] = entity.targetUserName;
  data['giftName'] = entity.giftName;
  data['price'] = entity.price;
  data['charmValue'] = entity.charmValue;
  data['amount'] = entity.amount;
  data['createTime'] = entity.createTime;
  data['group'] = entity.group;
  data['objectUrl'] = entity.objectUrl;
  data['giftType'] = entity.giftType;
  data['giftSonType'] = entity.giftSonType;
  data['hotValue'] = entity.hotValue;
  return data;
}

extension GiftRecordDtoListExtension on GiftRecordDtoList {
  GiftRecordDtoList copyWith({
    int? fromUserId,
    String? fromUserName,
    String? fromUserHeadUrl,
    int? targetUserId,
    String? targetUserName,
    String? giftName,
    int? price,
    int? charmValue,
    int? amount,
    String? createTime,
    int? group,
    String? objectUrl,
    int? giftType,
    int? giftSonType,
    int? hotValue,
  }) {
    return GiftRecordDtoList()
      ..fromUserId = fromUserId ?? this.fromUserId
      ..fromUserName = fromUserName ?? this.fromUserName
      ..fromUserHeadUrl = fromUserHeadUrl ?? this.fromUserHeadUrl
      ..targetUserId = targetUserId ?? this.targetUserId
      ..targetUserName = targetUserName ?? this.targetUserName
      ..giftName = giftName ?? this.giftName
      ..price = price ?? this.price
      ..charmValue = charmValue ?? this.charmValue
      ..amount = amount ?? this.amount
      ..createTime = createTime ?? this.createTime
      ..group = group ?? this.group
      ..objectUrl = objectUrl ?? this.objectUrl
      ..giftType = giftType ?? this.giftType
      ..giftSonType = giftSonType ?? this.giftSonType
      ..hotValue = hotValue ?? this.hotValue;
  }
}